package main

import "github.com/gin-gonic/gin"

type ColorsForm struct {
	Colors []string `form:"colors" json:"colors"`
}

func colorsHandler(ctx *gin.Context) {
	var colorsForm ColorsForm
	ctx.ShouldBind(&colorsForm)
	ctx.JSON(200, gin.H{
		"color": colorsForm.Colors,
	})
}

func main() {
	r := gin.Default()
	r.GET("bind-checkbox", colorsHandler)
	r.Run()
}
